package com.zima.mall.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zima.mall.entity.MallShoppingCartItem;
import com.zima.mall.vo.CartVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CartMapper extends BaseMapper<MallShoppingCartItem> {
    @Select("SELECT\n" +
            "action_carts.*,\n" +
            "action_products.`name` as `productName`,\n" +
            "action_products.price\n"+
            "FROM\n" +
            "action_carts ,\n" +
            "action_products\n" +
            "WHERE\n" +
            "action_carts.product_id = action_products.id AND\n" +
            "action_carts.user_id = ${id}\n")
    List<CartVo> findAllById(@Param("id") Integer id);

}
